\documentclass{article}
\usepackage{amsmath}
\begin{document}
\pagestyle{empty}
\begin{eqnarray*}
\hat{a} &=& \frac{\sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y})}{\sum_{i=1}^{n}(x_i-\bar{x})^2}
=\frac{n\sum_{i=1}^{n}x_i y_i - \sum_{i=1}^{n}x_i \sum_{i=1}^{n}y_i} 
{n\sum_{i=1}^{n}\left(x_i^2\right) - \big(\sum_{i=1}^{n}x_i\big)^2}\\
\hat{b} &=& \bar{y} - \hat{a}\bar{x}
\end{eqnarray*}
\end{document}
